home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 414 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.8 KB

  1. Path: chronicle.mti.sgi.com!austern
  2. From: claus@faerber.muc.de (Claus A. Faerber)
  3. Newsgroups: comp.std.c++
  4. Subject: Re: Are all Windows programs ill-formed?
  5. Date: 20 Feb 1996 10:39:57 PST
  6. Organization: -
  7. Approved: austern@isolde.mti.sgi.com
  8. Message-ID: <631ZyM9ocDB@faerber.muc.de>
  9. NNTP-Posting-Host: isolde.mti.sgi.com
  10. X-Original-Date: Sat, 17 Feb 1996 01:00:00 +0100
  11. In-Reply-To: <AE5J83na99@qsar.chem.msu.su>
  12. X-Mailer: CrossPoint v3.1 R/B17071
  13. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  14.     iQBVAwUBMSoViEy4NqrwXLNJAQE43gIAoULqWzlVoYiFRkdJHxiL5Y8nw0YgaOcu
  15.     FuKO+sRLzq0WwLf76uE5JCjIJCQWBbAZQcAd9uoMlUgNb2OaBnNe1Q==
  16.     =qJ+C
  17. Originator: austern@isolde.mti.sgi.com
  18.  
  19. Claus A. Faerber <claus@faerber.muc.de> (07 Feb 96):
  20.  
  21. > David Byrden <100101.2547@compuserve.com> (02 Feb 96):
  22. >
  23. > > >> It requires every program to have the main() function (which
  24. > > >> implementation is not allowed to supply) with parameters (void) or (int
  25. > > >> argc, int*argv[]). However, Windows programs have another convention:
  26. > > >> prrogram must contain the function  int WinMain
  27. > >
  28. > > I remember reading that you can write a Windows program with a main()
  29. > > function and the usual command line arguments, and then the Microsoft
  30. > > compiler will then generate WinMain somehow....but that the "operating
  31. > > system" does link to WinMain.
  32. >
  33. > No, the operating system doesn't care whether there is a
  34. > WinMain(), a main() or anything else. It just reads a
  35. > pointer  from the exe file and calls it. This is usually the
  36. > C/C++ statup code, which then calls WinMain() or main().
  37. > If there is a main present, the linker makes the startup
  38. > code call it, if not the linker either sets in an own
  39. > main(), which calls WinMain(), or another startup code,
  40. > which calls main().
  41.               ^^^ should be: WinMain()
  42.  
  43. But at all, there's no problem with Windows programs:
  44.  
  45. * If you're writing Win32 console apps or using special  
  46. libraries like EasyWin or QuickWin (which allow normal text  
  47. in/out operations in the Windows GUI), you will have a  
  48. standard main()
  49.  
  50. * If you're programming native Win16/32 GUI apps, you're  
  51. using an extended/modified C/C++-standard (unhosted env.),  
  52. as you don't have stdin/out/error and hundreds(thousands?)  
  53. of functions invading your namespace and: no main(), but Win/ 
  54. LibMain.
  55.  
  56. Claus
  57.  
  58. ------------------------------------------------------------------------
  59. Claus Andre Faerber - claus@faerber.muc.de - http://www.muc.de/~cfaerber
  60. ------------------------------------------------------------------------
  61. ---
  62. [ To submit articles: Try just posting with your newsreader.  If that fails,
  63.                       use mailto:std-c++@ncar.ucar.edu
  64.   FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html
  65.   Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html
  66.   Comments? mailto:std.c++-request@ncar.ucar.edu 
  67. ]
  68.